#!/usr/bin/env python
# -*- coding: utf-8 -*-

# This project is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This project is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Tutoo Installer.  If not, see <http://www.gnu.org/licenses/>.


from PyQt4 import QtGui, QtCore
from option_widget import *
import os

config_file = "config.file"

class Option_Frame(QtGui.QDialog):
	def __init__(self, parent=None):
		QtGui.QDialog.__init__(self, parent) if parent else QtGui.QDialog.__init__(self)
		self.ui = Ui_Dialog()
		self.ui.setupUi(self)

		try:
			f = open(config_file)
			contents = f.readlines()
			f.close()
			for i in contents:
				if i.find('arp_path') != -1:
					self.ui.lineEdit.setText(i.split('=')[1])
		except:
			print 'file missing: %s' % config_file



	def setPath(self):
		print self.ui.lineEdit.text()

	def closeEvent(self, QCloseEvent):
		f = open(config_file, 'w')
		f.write('arp_path=%s' % str(self.ui.lineEdit.text()))
		f.close()

if __name__ == "__main__":
	import sys
	app = QtGui.QApplication(sys.argv)
	ui = Option_Frame()
	ui.show()
	app.exec_()
